package com.china.great.system.service.impl;

import com.china.great.system.dao.RoleMapper;
import com.china.great.system.entity.Role;
import com.china.great.system.service.SystemRoleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Liu HongYang
 * @DateTime: 2020/5/4 4:36 下午
 * @Description: TODO
 */
@Service
public class SystemRoleServiceImpl implements SystemRoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public PageInfo<Role> getRoleList(int pageSize, int pageNum) {
        PageHelper.startPage(pageNum,10);
        List<Role> roleList = roleMapper.getRoleList(pageSize,pageNum);
        PageInfo pageInfo = new PageInfo(roleList);
        return  pageInfo;
    }

    @Override
    public Role getRole(long userId) {
        return roleMapper.getRole(userId);
    }
}
